<template>
  <div class="wm-checkin" v-loading="loading">
    <el-form ref="fmData" :model="fmData" :rules="rules" v-if="fmData != null">
      <div class="purchas-information">
        <el-card class="box-card">
          <div slot="header" class="unfold-way">
            <p>入库单</p>
            <!-- <p>入库单---蓝红字：{{ fmData.bredVouch }}</p> -->
            <div class="button-plan">
              <span
                v-if="
                  fmStatus == 'seeStatus' && $route.query.open !== 'addStatus'
                "
              >
                <el-button
                  @click="btnAdd('view')"
                  type="primary"
                  v-hasPermi="['wm:checkin:entity:add']"
                  :disabled="option.stripStatus"
                >
                  新增</el-button
                >
              </span>
              <span
                v-if="
                  fmStatus == 'seeStatus' && $route.query.open == 'addStatus'
                "
              >
                <el-button
                  @click="btnAdd('add')"
                  type="primary"
                  v-hasPermi="['wm:checkin:entity:add']"
                  :disabled="option.stripStatus"
                  v-if="fmStatus == 'seeStatus'"
                >
                  新增</el-button
                >
              </span>
              <span v-if="fmStatus == 'updateStatus'">
                <el-button
                  type="primary"
                  @click="btnSave(fmData)"
                  :disabled="option.btnIsClick || fmStatus !== 'updateStatus'"
                  v-hasPermi="['wm:checkin:entity:edit']"
                  >保存</el-button
                >
                <el-button type="succes" @click="btnUndo">撤回</el-button>
              </span>
              <span v-if="fmStatus == 'addStatus'">
                <el-button
                  type="primary"
                  v-hasPermi="['wm:checkin:entity:add']"
                  @click="btnNew(fmData)"
                  :disabled="option.btnIsClick"
                  >保存</el-button
                >
              </span>
              <span>
                <el-button
                  type="succes"
                  v-if="fmStatus == 'seeStatus'"
                  v-hasPermi="['wm:checkin:entity:edit']"
                  @click="btnEdit"
                  :disabled="
                    fmData.invoiceStatus == '1' || fmStatus !== 'seeStatus'
                  "
                  >编辑</el-button
                >
                <el-button
                  type="succes"
                  v-if="fmStatus == 'addStatus'"
                  @click="btnCancel"
                  >取消</el-button
                >
                <el-button
                  type="success"
                  v-hasPermi="['wm:checkin:permit']"
                  @click="btnCheck"
                  :disabled="
                    fmStatus !== 'seeStatus' ||
                    fmData.invoiceStatus == '1' ||
                    fmData.invoiceStatus == '2'
                  "
                >
                  审核</el-button
                >
                <el-button
                  type="info"
                  v-hasPermi="['wm:checkin:revoke']"
                  @click="btnUnCheck"
                  :disabled="
                    fmStatus !== 'seeStatus' ||
                    fmData.invoiceStatus == '0' ||
                    fmData.invoiceStatus == '2'
                  "
                  >反审核
                </el-button>
              </span>

              <span>
                <el-button
                  type="success"
                  plain
                  icon="el-icon-printer"
                  size="mini"
                  @click="objPrinter.handlePrint()"
                  v-hasPermi="['wm:checkin:print']"
                  v-if="fmStatus == 'seeStatus'"
                  >打印</el-button
                >
                <el-dropdown
                  @command="btnOperation"
                  trigger="click"
                  v-hasPermi="['wm:checkin:operate']"
                  v-if="fmStatus == 'seeStatus' || fmStatus == 'updateStatus'"
                >
                  <el-button type="primary" plain>
                    操作<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown" class="menu-drop-in">
                    <el-dropdown-item
                      :command="'1'"
                      :class="{ active: stack.commandIndex == '1' }"
                    >
                      <i
                        class="el-icon-check"
                        v-if="stack.commandIndex == '1'"
                      ></i
                      ><span>挂起</span>
                    </el-dropdown-item>
                    <el-dropdown-item
                      :command="'2'"
                      :class="{ active: stack.commandIndex == '2' }"
                    >
                      <i
                        class="el-icon-check"
                        v-if="stack.commandIndex == '2'"
                      ></i
                      ><span>关闭</span>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </span>
              <span>
                <el-button
                  type="text"
                  @click="objHelper.downToggle()"
                  style="padding: 0"
                  >{{ style.downTitle }}</el-button
                >
              </span>
            </div>
          </div>
          <collapseTransition>
            <div class="info-list" v-show="style.isToggle" ref="toggleBox">
              <div class="wn-in-box">
                <div class="list-box">
                  <div class="box-input">
                    <p>单据编码：</p>
                    <el-form-item>
                      <el-input
                        type="input"
                        :class="[
                          fmData.bredVouch == '0' ? 'code-blue' : '',
                          fmData.bredVouch == '1' ? 'code-red' : '',
                          fmData.bredVouch == '2' ? 'code-yellow' : '',
                        ]"
                        v-model="fmData.wmCode"
                        disabled
                      >
                      </el-input>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>单据日期：</p>
                    <el-form-item prop="invoiceDate">
                      <el-date-picker
                        class="input-data"
                        type="date"
                        :disabled="option.disabledInput"
                        placeholder="选择日期"
                        v-model="fmData.invoiceDate"
                        style="width: 100%"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </div>
                  <div class="box-input blue-color">
                    <p>单据状态：</p>
                    <div class="invoice-box">
                      <span
                        v-if="fmData.invoiceStatus == '0'"
                        style="color: #e6a23c"
                        >{{ fmData.invoiceStatus | getInvoice }}</span
                      >
                      <span
                        v-if="fmData.invoiceStatus == '1'"
                        style="color: #67c23a"
                        >{{ fmData.invoiceStatus | getInvoice }}</span
                      >
                      <span
                        v-if="fmData.invoiceStatus == '2'"
                        style="color: #909399"
                        >{{ fmData.invoiceStatus | getInvoice }}</span
                      >
                    </div>
                  </div>
                  <div class="box-input">
                    <p>单据类型：</p>
                    <el-form-item prop="invoiceType">
                      <el-select
                        v-model="fmData.invoiceType"
                        placeholder="请选择"
                        disabled
                      >
                        <el-option
                          v-for="item in enums.optionsInvoiceType"
                          :key="item.dictValue"
                          :label="item.dictLabel"
                          :value="item.dictValue"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>
                </div>
                <div class="list-box">
                  <div class="box-input">
                    <p>业务类型：</p>
                    <el-form-item prop="workType">
                      <el-select
                        v-model="fmData.workType"
                        :disabled="
                          option.wmworkStatus ||
                          entryMode ||
                          fmData.bredVouch == '1'
                        "
                        placeholder="请选择"
                        @change="objHelper.workTypeChange($event)"
                      >
                        <el-option
                          v-for="item in enums.optionsworkType"
                          :key="item.dictValue"
                          :label="item.dictLabel"
                          :value="item.dictValue"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>
                  <div class="box-input blue-color">
                    <p>业务状态：</p>
                    <el-form-item prop="workStatus">
                      <el-select
                        v-model="fmData.workStatus"
                        :disabled="option.disabledInput"
                        placeholder="请选择"
                      >
                        <el-option
                          v-for="item in enums.optionsworkStatus"
                          :key="item.dictValue"
                          :label="item.dictLabel"
                          :value="item.dictValue"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>业务部门：</p>
                    <el-form-item prop="workDept">
                      <el-cascader
                        v-model="enums.selectworkDept"
                        :options="enums.optionsworkDept"
                        :disabled="
                          option.disabledInput || fmData.bredVouch == '1'
                        "
                        :props="style.classProps"
                        @change="objHelper.workDeptChange($event)"
                        ref="classTree"
                        class="cas-input"
                      ></el-cascader>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>业务人员：</p>
                    <el-form-item prop="workStaff">
                      <el-select
                        v-model="enums.selectworkStaff"
                        :disabled="
                          option.disabledInput ||
                          fmData.workDept == '' ||
                          fmData.bredVouch == '1'
                        "
                        @change="objHelper.workStaffChange($event)"
                      >
                        <el-option
                          v-for="(item, id) in enums.optionsworkStaff"
                          :key="id"
                          :label="item.nickName"
                          :value="item.nickName"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>
                </div>
                <div class="list-box">
                  <div class="box-input">
                    <p>操作员：</p>
                    <el-form-item>
                      <el-input v-model="fmData.userOper" disabled> </el-input>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>审核员：</p>
                    <el-form-item>
                      <el-input v-model="fmData.userCheck" disabled> </el-input>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>审核日期：</p>
                    <el-form-item prop="checkDate">
                      <el-date-picker
                        class="input-data"
                        type="date"
                        v-model="fmData.checkDate"
                        style="width: 100%"
                        disabled
                      ></el-date-picker>
                    </el-form-item>
                  </div>
                  <div class="box-input">
                    <p>期间：</p>
                    <el-form-item style="position: relative">
                      <el-select
                        v-model="enums.selectperiod"
                        class="period-select"
                        placeholder="请选择"
                        @change="objHelper.periodChange"
                        :disabled="option.disabledInput"
                      >
                        <el-option
                          v-for="(item, period) in enums.optionsperiod"
                          :key="period"
                          :label="item.period"
                          :value="item.period"
                        >
                        </el-option>
                      </el-select>
                      <i class="el-icon-date period-date"></i>
                    </el-form-item>
                  </div>
                </div>
                <div class="list-box">
                  <div class="box-input">
                    <p>仓库：</p>
                    <el-form-item prop="warehouse">
                      <el-select
                        v-model="enums.selectwarehouse"
                        placeholder="请选择"
                        :disabled="
                          option.wmworkStatus ||
                          entryMode ||
                          fmData.bredVouch == '1'
                        "
                        @change="objWarehouse.warehouseChange($event)"
                      >
                        <el-option
                          v-for="(item, index) in enums.optionswarehouse"
                          :key="index"
                          :label="item.name"
                          :value="item.code"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>

                  <!-- 蓝字时显示 -->
                  <div v-if="fmData.bredVouch == 0">
                    <div class="box-input" v-if="fmData.workType == '0'">
                      <p>到货单号：</p>
                      <el-form-item prop="poCheckinCode">
                        <el-input
                          type="text"
                          v-model="fmData.poCheckinCode"
                          disabled
                        ></el-input>
                      </el-form-item>
                    </div>
                    <div
                      class="box-input"
                      v-if="fmData.workType == 0"
                      v-hasPermi="['wm:checkin:supplier']"
                    >
                      <p style="width: 70px !important">供方：</p>
                      <el-form-item>
                        <el-input
                          type="input"
                          @input="
                            objFilling.searchPoPuPrs(
                              fmData.supplier,
                              'poSearch'
                            )
                          "
                          v-model="fmData.supplier"
                          @keypress.native.enter="
                            objFilling.nameEnter(fmData.supplier, 'poSearch')
                          "
                          :disabled="
                            stack.supplierStatus == true ||
                            fmStatus !== 'addStatus'
                          "
                        >
                        </el-input>
                      </el-form-item>
                      <div
                        v-if="
                          fmStatus == 'addStatus' &&
                          stack.supplierStatus == false
                        "
                      >
                        <el-link
                          class="input-select"
                          type="primary"
                          v-if="!stack.poStatus"
                          @click="objFilling.handlePoPuPrs('po')"
                          >选择
                        </el-link>
                      </div>
                      <div class="select-popu" v-if="stack.poSearchStatus">
                        <div class="drop-menu">
                          <div class="ma-list">
                            <div class="menu-close">
                              <div class="search-top">
                                <span>搜索结果</span>
                                <a
                                  class="el-icon-close"
                                  @click="
                                    objFilling.handleClosePoPuPrs('poSearch')
                                  "
                                ></a>
                              </div>
                            </div>
                            <p v-if="enums.optionssupplier.length == 0">
                              无数据
                            </p>
                            <div
                              class="list-t"
                              v-for="(item, index) in enums.optionssupplier"
                              @click="
                                objFilling.successPoPuPrs(item, 'poSearch')
                              "
                              :key="index"
                            >
                              <div class="po-content">
                                <span>{{ item.name }}</span>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="box-input" v-if="fmData.workType == '1'">
                      <p>生产单号：</p>
                      <el-form-item prop="prsCheckinCode">
                        <el-input
                          type="text"
                          v-model="fmData.prsCheckinCode"
                          disabled
                        ></el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input" v-if="fmData.workType == '1'">
                      <p>加工车间：</p>
                      <el-form-item>
                        <el-input v-model="fmData.productionWorkshop" disabled>
                        </el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input" v-if="fmData.workType == '2'">
                      <p>到货单号：</p>
                      <el-form-item prop="puCheckinCode">
                        <el-input
                          type="text"
                          v-model="fmData.puCheckinCode"
                          :disabled="option.disabledInput"
                        ></el-input>
                      </el-form-item>
                    </div>
                    <div
                      class="box-input"
                      v-if="fmData.workType == '2'"
                      v-hasPermi="['wm:checkin:outsource']"
                    >
                      <p>外协厂家：</p>
                      <el-form-item>
                        <el-input
                          @input="
                            objFilling.searchPoPuPrs(
                              fmData.outSource,
                              'puSearch'
                            )
                          "
                          @keypress.native.enter="
                            objFilling.nameEnter(fmData.outSource, 'puSearch')
                          "
                          v-model="fmData.outSource"
                          :disabled="option.disabledInput"
                        >
                        </el-input>
                      </el-form-item>
                      <div v-if="fmStatus !== 'seeStatus'">
                        <el-link
                          class="input-select"
                          type="primary"
                          v-if="!stack.puStatus"
                          @click="objFilling.handlePoPuPrs('pu')"
                          >选择
                        </el-link>
                        <el-link
                          class="input-select"
                          type="info"
                          v-if="stack.puStatus"
                          @click="objFilling.handleClosePoPuPrs('pu')"
                          >取消
                        </el-link>
                      </div>
                      <div class="select-popu" v-if="stack.puSearchStatus">
                        <div class="drop-menu">
                          <div class="ma-list">
                            <div class="menu-close">
                              <div class="search-top">
                                <span>搜索结果</span>
                                <a
                                  class="el-icon-close"
                                  @click="
                                    objFilling.handleClosePoPuPrs('puSearch')
                                  "
                                ></a>
                              </div>
                            </div>
                            <p v-if="enums.optionsoutsource.length == 0">
                              无数据
                            </p>
                            <div
                              class="list-t"
                              v-for="(item, index) in enums.optionsoutsource"
                              @click="
                                objFilling.successPoPuPrs(item, 'puSearch')
                              "
                              :key="index"
                            >
                              <div class="po-content">
                                <span>{{ item.name }}</span>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="box-input">
                      <p>备注信息：</p>
                      <el-form-item prop="remarks">
                        <el-input
                          type="textarea"
                          autosize
                          v-model="fmData.remarks"
                          :disabled="option.disabledInput"
                        ></el-input>
                      </el-form-item>
                    </div>
                  </div>
                  <!-- 红字时显示 -->
                  <div v-if="fmData.bredVouch == 1">
                    <div class="box-input" v-if="fmData.workType == '0'">
                      <p>退货单号：</p>
                      <el-form-item prop="omRejectCode">
                        <el-input
                          type="text"
                          v-model="fmData.omRejectCode"
                          :disabled="option.disabledInput"
                        ></el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input" v-if="fmData.workType == 0">
                      <p style="width: 70px !important">销售客户：</p>
                      <el-form-item>
                        <el-input
                          type="input"
                          v-model="fmData.customer"
                          disabled
                        >
                        </el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input" v-if="fmData.workType == '2'">
                      <p>退料单号：</p>
                      <el-form-item>
                        <el-input
                          type="input"
                          v-model="fmData.puRejectCode"
                          disabled
                        >
                        </el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input" v-if="fmData.workType == '1'">
                      <p>退料单号：</p>
                      <el-form-item>
                        <el-input
                          type="input"
                          v-model="fmData.prsRejectCode"
                          disabled
                        >
                        </el-input>
                      </el-form-item>
                    </div>
                    <div
                      class="box-input"
                      v-if="fmData.workType == '2'"
                      v-hasPermi="['wm:checkin:outsource']"
                    >
                      <p>外协厂家：</p>
                      <el-form-item>
                        <el-input v-model="fmData.outSource" disabled>
                        </el-input>
                      </el-form-item>
                    </div>
                    <div class="box-input">
                      <p>备注信息：</p>
                      <el-form-item prop="remarks">
                        <el-input
                          type="textarea"
                          autosize
                          v-model="fmData.remarks"
                          :disabled="option.disabledInput"
                        ></el-input>
                      </el-form-item>
                    </div>
                  </div>
                </div>
              </div>
              <div class="articles-numbers" v-if="fmStatus == 'seeStatus'">
                <el-link
                  type="success"
                  v-hasPermi="['wm:checkin:next']"
                  @click="btnForward(fmData.wmCode, 'last')"
                  :disabled="option.stripStatus"
                  >上一条
                </el-link>
                <el-link
                  type="success"
                  v-hasPermi="['wm:checkin:next']"
                  @click="btnForward(fmData.wmCode, 'next')"
                  :disabled="option.stripStatus"
                  >下一条
                </el-link>
              </div>
            </div>
          </collapseTransition>
        </el-card>
      </div>
      <div class="purchas-content" v-show="option.parametersStatus == true">
        <el-card class="box-card">
          <div slot="header" class="unfold-way">
            <p>物料信息</p>
            <div>
              <!-- 红字引入 -->
              <el-button
                v-hasPermi="['wm:checkin:import']"
                type="warning"
                icon="el-icon-download"
                plain
                @click="objLeadin.btnOmReject()"
                v-if="
                  (fmStatus == 'addStatus' && fmData.bredVouch == '1') ||
                  (fmStatus == 'updateStatus' && fmData.bredVouch == '1')
                "
              >
                引入</el-button
              >
              <!-- 采购入库引入 -->
              <el-button
                v-hasPermi="['wm:checkin:import']"
                type="warning"
                icon="el-icon-download"
                plain
                @click="objLeadin.btnPurchaseCheckin()"
                v-if="
                  fmData.workType == '0' &&
                  fmStatus !== 'seeStatus' &&
                  fmData.bredVouch == '0'
                "
              >
                引入</el-button
              >
              <!-- 生产入库引入 -->
              <el-button
                v-hasPermi="['wm:checkin:import']"
                type="warning"
                icon="el-icon-download"
                plain
                @click="objLeadin.btnPrsCheckin()"
                v-if="
                  fmData.workType == '1' &&
                  fmStatus !== 'seeStatus' &&
                  fmData.bredVouch == '0'
                "
              >
                引入</el-button
              >
              <el-button
                type="primary"
                plain
                icon="el-icon-plus"
                :disabled="enums.selectwarehouse == ''"
                @click="objMaterial.addMaterial()"
                v-if="
                  (fmStatus == 'addStatus' &&
                    fmData.bredVouch !== '1' &&
                    fmData.workType == '3') ||
                  (fmStatus == 'updateStatus' &&
                    fmData.bredVouch !== '1' &&
                    fmData.workType == '3')
                "
              >
                新增物料</el-button
              >
            </div>
          </div>
          <div class="info-table">
            <div class="table-data">
              <el-table
                :data="fmData.wmInSalveList"
                border
                ref="tableClums"
                :height="style.tableHeight"
                style="width: 100%"
              >
                <template slot="empty">
                  <span></span>
                </template>
                <el-table-column type="index" width="40" label="序号" :key="1">
                </el-table-column>
                <el-table-column label="销售单号" width="130" :key="2">
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.ppNumber"
                        :disabled="
                          fmData.workType !== '3' && !option.disabledInput
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column label="物料编码" :key="3" width="120">
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.invCode'"
                      :rules="rules.invCode"
                    >
                      <div class="select-box">
                        <div class="select-name">
                          <el-input
                            v-model="scope.row.invCode"
                            @input="
                              objMaterial.searchCode(scope.$index, scope.row)
                            "
                            @keypress.native.enter="objMaterial.codeEnter()"
                            :disabled="
                              option.disabledInput ||
                              enums.selectwarehouse == '' ||
                              fmData.bredVouch == '1' ||
                              fmData.workType !== '3'
                            "
                            placeholder=""
                          >
                          </el-input>
                          <el-link
                            @click="objMaterial.btnItem(scope.$index)"
                            type="primary"
                            v-if="
                              (fmStatus == 'addStatus' &&
                                fmData.bredVouch !== '1' &&
                                fmData.workType == '3') ||
                              (fmStatus == 'updateStatus' &&
                                fmData.bredVouch !== '1' &&
                                fmData.workType == '3')
                            "
                            :disabled="enums.selectwarehouse == ''"
                            >选择</el-link
                          >
                        </div>
                        <div
                          class="drop-menu1"
                          ref="drop"
                          v-show="scope.$index == stack.saveIndex"
                          :name="scope.$index"
                        >
                          <div class="ma-list">
                            <div class="menu-close">
                              <div class="search-top">
                                <span>搜索结果</span>
                                <a
                                  class="el-icon-close"
                                  @click="objMaterial.handleHide()"
                                ></a>
                              </div>
                            </div>
                            <p v-if="stack.basicfileList.length == 0">无数据</p>
                            <div
                              class="list-t"
                              v-for="(item, index) in stack.basicfileList"
                              :keys="index"
                              @click="objMaterial.successSelect(item)"
                              :key="index"
                              v-else
                            >
                              <div>
                                <span>{{ item.code }}</span>
                                <span
                                  >{{ item.name }}&nbsp;{{
                                    item.attribute
                                  }}</span
                                >
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column label="物料名称" :key="4" width="250">
                  <template slot-scope="scope">
                    <div class="con-spec" v-if="fmConfig.attrMerge == 'true'">
                      <span
                        >{{ scope.row.invName
                        }}{{ scope.row.invAttribute }}</span
                      >
                    </div>
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.invName'"
                      :rules="rules.invName"
                      v-if="fmConfig.attrMerge == 'false'"
                    >
                      <div class="select-name">
                        <el-input v-model="scope.row.invName" disabled>
                        </el-input>
                      </div>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  :label="fmConfig.attrAlias"
                  v-if="fmConfig.attrMerge == 'false'"
                  width="125"
                  :key="5"
                >
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.invAttribute'"
                      :rules="rules.invAttribute"
                    >
                      <el-input v-model="scope.row.invAttribute" disabled>
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column label="主计量" width="70" :key="6">
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.unitName'"
                      :rules="rules.unitName"
                    >
                      <el-input v-model="scope.row.unitName" disabled>
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="quantity"
                  label="数量"
                  width="150"
                  :key="7"
                >
                  <template slot-scope="scope">
                    <el-form-item
                      class="text-right"
                      :prop="'wmInSalveList.' + scope.$index + '.quantity'"
                      :rules="rules.quantity"
                    >
                      <el-input
                        v-model="scope.row.quantity"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.bredVouch == '1'
                        "
                        @change="
                          objUtils.formatDecimal(scope.$index, scope.row)
                        "
                        style="text-align: right"
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column label="批号" width="150" :key="8">
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.batchNumber"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <!-- 特殊属性 -->
                <el-table-column
                  :label="fmConfig.property[0]"
                  width="100"
                  v-if="fmConfig.property.length > 0"
                  :key="9"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.f1"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  :label="fmConfig.property[1]"
                  width="100"
                  v-if="fmConfig.property.length > 1"
                  :key="10"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.f2"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  :label="fmConfig.property[2]"
                  width="100"
                  v-if="fmConfig.property.length > 2"
                  :key="11"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.f3"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  :label="fmConfig.property[3]"
                  width="100"
                  v-if="fmConfig.property.length > 3"
                  :key="12"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.f4"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  :label="fmConfig.property[4]"
                  width="100"
                  v-if="fmConfig.property.length > 4"
                  :key="13"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input
                        v-model="scope.row.f5"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.workType !== '3' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  label="生产线"
                  v-if="fmData.workType == '1'"
                  width="120"
                  :key="14"
                >
                  <template slot-scope="scope">
                    <el-form-item>
                      <el-input v-model="scope.row.beltline" disabled>
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="location"
                  label="货位"
                  v-hasPermi="['wm:checkin:location']"
                  width="150"
                  v-if="stack.locationStatus"
                  :key="15"
                >
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.location'"
                      :rules="rules.location"
                    >
                      <div class="set-location">
                        <el-input
                          v-model="scope.row.location"
                          :disabled="
                            option.disabledInput ||
                            enums.selectwarehouse == '' ||
                            fmData.bredVouch == '1'
                          "
                        >
                        </el-input>
                        <el-link
                          class="location-btn"
                          @click="objLocation.locationChange(scope.$index)"
                          type="primary"
                          v-show="
                            (fmStatus == 'addStatus' &&
                              scope.row.invCode !== '' &&
                              fmData.bredVouch !== '1') ||
                            (fmStatus == 'updateStatus' &&
                              scope.row.invCode !== '' &&
                              fmData.bredVouch !== '1')
                          "
                        >
                          选择</el-link
                        >
                      </div>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column prop="remarks" label="备注" :key="16">
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'wmInSalveList.' + scope.$index + '.remarks'"
                      :rules="rules.remarks"
                    >
                      <el-input
                        type="text"
                        autosize
                        v-model="scope.row.remarks"
                        :disabled="
                          option.disabledInput ||
                          enums.selectwarehouse == '' ||
                          fmData.bredVouch == '1'
                        "
                      >
                      </el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="50"
                  v-if="fmStatus == 'addStatus' || fmStatus == 'updateStatus'"
                  :key="17"
                >
                  <template slot-scope="scope">
                    <el-link
                      type="danger"
                      plain
                      @click="objMaterial.deleteList(scope.$index)"
                      :disabled="enums.selectwarehouse == ''"
                      >删除
                    </el-link>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </el-card>
      </div>
    </el-form>
    <!-- 物料组件 -->
    <selectMaterial
      @handleSelect="objMaterial.handleSelect(arguments)"
      :sortArrId="stack.sortArrId"
      :selectDialog="stack.selectDialog"
      v-show="stack.selectDialog"
      @selectClose="objMaterial.selectClose()"
    />
    <!-- 客户组件 -->
    <selectCustomer
      :selectCustomerDialog="stack.omStatus"
      @handleCustomerSelect="objFilling.handleCustomerSelect($event)"
      v-if="stack.omStatus"
      @selectCustomerClose="objFilling.selectCustomerClose()"
    />
    <!-- 供方组件 -->
    <selectSupplier
      :selectSupplierDialog="stack.poStatus"
      @handleSupplierSelect="objFilling.handleSupplierSelect($event)"
      v-if="stack.poStatus"
      @selectSupplierClose="objFilling.selectSupplierClose()"
    />
    <!-- 生产商（外协厂家） -->
    <selectOutsource
      :selectOutsourceDialog="stack.puStatus"
      @handleOutsourceSelect="objFilling.handleOutsourceSelect($event)"
      v-if="stack.puStatus"
      @selectOutsourceClose="objFilling.selectOutsourceClose()"
    />
    <!-- 选择货位 -->
    <selectLocation
      :selectLocationDialog="stack.isLocation"
      :whCode="enums.selectwarehouse"
      :whName="stack.whName"
      @handleLocationSelect="objLocation.handleLocationSelect($event)"
      v-if="stack.isLocation"
      @selectLocationClose="objLocation.selectLocationClose()"
    />
    <!-- 选择引入物料组件 -->
    <selectImportMaterial
      :selectImportMaterialDialog="stack.ImportMaterialStatus"
      @handleImportMaterialSelect="
        objMaterial.handleImportMaterialSelect($event)
      "
      v-if="stack.ImportMaterialStatus"
      @selectImportMaterialClose="objMaterial.selectImportMaterialClose()"
      :wmSpecail="fmConfig.property"
      :ImportMaterialCode="stack.ImportMaterialCode"
      @handleImportMaterialSuccess="
        objMaterial.handleImportMaterialSuccess($event)
      "
    />

    <!-- 采购入库引入 -->
    <purchaseCheckin
      :purchaseCheckinDialog="stack.purchaseCheckinStatus"
      :warehouse="enums.selectwarehouse"
      :decimal="fmConfig.decimalQuantity"
      v-if="stack.purchaseCheckinStatus"
      @purchaseCheckinClose="objLeadin.purchaseCheckinClose()"
      @handlePurchaseCheckinSuccess="
        objLeadin.handlePurchaseCheckinSuccess(arguments)
      "
    />

    <!-- 生产入库引入 -->
    <prsCheckin
      :prsCheckinDialog="stack.prsCheckinStatus"
      :decimal="fmConfig.decimalQuantity"
      :warehouse="enums.selectwarehouse"
      v-if="stack.prsCheckinStatus"
      @prsCheckinClose="objLeadin.prsCheckinClose()"
      @handlePrsCheckinSuccess="objLeadin.handlePrsCheckinSuccess(arguments)"
    />

    <!-- 销售退货引入 -->
    <omReject
      :omRejectDialog="stack.omRejectStatus"
      :decimal="fmConfig.decimalQuantity"
      :warehouse="enums.selectwarehouse"
      v-if="stack.omRejectStatus"
      @omRejectClose="objLeadin.omRejectClose()"
      @handleOmRejectSuccess="objLeadin.handleOmRejectSuccess(arguments)"
    />

    <!-- 打印数据 -->
    <PrintPage
      :printData="print.printData"
      v-if="print.printStatus"
      ref="startPrint"
      :title="print.printTitle"
      :wmSpecail="fmConfig.property"
      :locationStatus="stack.locationStatus"
      :priceStatus="option.priceStatus"
    />
  </div>
</template>

<script>
//接口
import {
  dictMatching, //系统字典
  listDept, //部门列表
  listUser, //业务人员(用户)
  listWarehouses, //仓库列表
  checkWarehouses, //仓库信息查询
  examineBill, //审核单据
  examineDeBill, //反审核单据
  listMaterial, //物料信息
  listSupplier, //供方
  listEquipment, //加工设备
  listOutsource, //生产商（外协厂家）
  listCustomer, //客户
  addMaster,
  seeMaster,
  updateMaster,
  NextInMaster,
  blanceAvailable, //可结存期间
  operationBill, //操作
  moduleParameters,
} from "../../api/checkin";
//js方法
import { getTreeData, getEcho } from "../../utils/checkin";
//并行请求
import axios from "axios";
//打印js
import print from "print-js";
//输入是否为数字效验
import { isAccord } from "@/utils/cingsoft";
// 物料选择组件
import selectMaterial from "./selectMaterial.vue";
//客户选择组件
import selectCustomer from "./selectCustomer.vue";
//供方选择组件
import selectSupplier from "./selectSupplier.vue";
//生产商(外协厂家)选择组件
import selectOutsource from "./selectOutsource.vue";
//选择引入物料组件
import selectImportMaterial from "./selectImportMaterial.vue";
//选择组件
import selectLocation from "./selectLocation.vue"; //货位组件
//采购入库引入
import purchaseCheckin from "./purchaseCheckin.vue";
//生产入库引入
import prsCheckin from "./prsCheckin.vue";
//销售退货引入
import omReject from "./omReject.vue";
//打印组件
import PrintPage from "../../components/Checkin/print";
export default {
  data() {
    // 单价输入效验
    var checkOutPrice = (rule, value, callback) => {
      if (!value) {
        return callback(new Error(""));
      }
      if (!isAccord(value)) {
        callback(new Error(""));
      } else {
        callback();
      }
    };

    // 数量输入效验
    var checkOutQuantity = (rule, value, callback) => {
      if (!value) {
        return callback(new Error(""));
      }
      if (!isAccord(value)) {
        callback(new Error(""));
      } else {
        callback();
      }
    };
    return {
      // 遮罩层
      loading: true,

      //初始化状态
      initialStatus: false,

      // 进入表单模式，有参、无参
      entryMode: false,

      //进入表单参数
      entry: {
        //记录编辑查看物料编码
        seeCode: "",
        //记录当前路由信息用于关闭当前页面
        routeMsg: {},
        // 记录fmConfig
        setConfig: "",
        //仓库代码
        whCode: "",
        // 记录蓝字红字
        recordBredVouch: "",
      },

      //表单状态-addStatus:新增状态,seeStatus:查看状态,updateStatus:编辑状态
      fmStatus: "",

      //数据表单
      fmData: {},

      //添加物料
      fmItem: {
        invSortId: "", //物料分类
        invCode: "", //物料编码
        invName: "", //物料名称
        invAttribute: "", //型号规格
        unitName: "", //主计量
        unitCode: "", //主计量
        quantity: "", //数量
        price: "0.00", //单价
        amount: "0.00", //金额
        batchNumber: "", //批号
        ppNumber: "",
        location: "", //货位
        remarks: "", //备注
      },

      //单据参数
      fmConfig: {
        //数量小数位数
        decimalQuantity: "2",
        //单价小数位数
        decimalPrice: "2",
        //规格合并
        attrMerge: "false",
        //规格别名
        attrAlias: "型号规格",
        //隐藏字段
        fieldHiding: [],
        //特殊属性
        property: [],
      },

      // 物料查询参数
      query: {
        code: "",
        sortRoot: "",
        type: true,
      },

      //选项
      option: {
        //按钮是否禁用
        btnIsClick: false,
        //输入框是否禁用
        disabledInput: false,
        //业务类型是否可更改
        wmworkStatus: false,
        //上一条下一条状态
        stripStatus: false,
        // 物料信息状态
        parametersStatus: false,
        //单价状态
        priceStatus: true,
      },

      //枚举
      enums: {
        //单据类型
        optionsInvoiceType: [],
        //业务类型
        optionsworkType: [],
        selectworkType: "",
        workTypeInit: [],
        //业务部门
        optionsworkDept: [],
        selectworkDept: [],
        //业务状态
        optionsworkStatus: [],
        //客户
        optionscustomer: [],
        //供方
        optionssupplier: [],
        //外协厂家
        optionsoutsource: [],
        //加工设备
        optionsproductionLine: [],
        //结存期间
        optionsperiod: [],
        selectperiod: "",
        //仓库
        optionswarehouse: [],
        selectwarehouse: "",
        //业务人员
        optionsworkStaff: [],
        selectworkStaff: "",
      },

      //执行中
      stack: {
        //操作下拉切换
        commandIndex: "",
        //是否为搜索客户
        omStatus: false,
        //客户搜索下拉状态
        omSearchStatus: false,
        //点击选择物料记录下标，用于更新物料信息
        rowIndex: "",
        //物料选择弹框状态
        selectDialog: false,
        // 物料编码搜索下拉状态
        saveIndex: null,
        // 物料编码搜索数据
        basicfileList: [],
        // 引入信息
        optionsImportMaterial: [],
        ImportMaterialStatus: false,
        //供方
        poStatus: false,
        poSearchStatus: false,
        //外协厂家
        puStatus: false,
        puSearchStatus: false,
        workTypeStatus: false,
        //加工设备
        prsStatus: false,
        deptId: "",
        //货位显示状态 是否启用货位
        locationStatus: true,
        // 货位信息
        optionslocation: [],
        isLocation: false, //货位组件状态
        whName: "", //仓库名称
        //采购入库引入
        purchaseCheckinStatus: false,
        //生产入库引入
        prsCheckinStatus: false,
        //销售退货单引入
        omRejectStatus: false,
        // 供方输入状态
        supplierStatus: false,
        //料品大类
        sortArrId: [],
        // 引入组件传值 仓库code/料品code/物料大类特殊属性
        ImportMaterialCode: {
          workType: "",
          warehouse: "",
        },
      },

      //样式
      style: {
        // 展开收起
        isToggle: true, //状态
        downTitle: "收起", //按钮辩题
        tableHeight: "", //物料信息高度
        //销售部门选择配置
        classProps: {
          children: "children",
          label: "deptName",
          value: "deptId",
        },
      },

      //打印
      print: {
        //打印组件状态
        printStatus: false,
        //打印数据
        printData: {},
        //打印名称
        printName: "入库单",
        //打印标题
        printTitle: "",
        //二维码内容
        qrCodeValue: "",
        //打印部门
        printWorkDept: [],
      },

      //内存优化
      objWarehouse: this.classWarehouse(), //仓库
      objMaterial: this.classMaterial(), //物料
      objFilling: this.classFilling(), //供方/设备/客户
      objLocation: this.classLocation(), //货位
      objLeadin: this.classLeadin(), //引入
      objHelper: this.classHelper(), //助手
      objPrinter: this.classPrinter(), //打印
      objUtils: this.classUtils(), //工具

      //配置是否必须输入
      rules: {
        invoiceDate: [
          {
            required: true,
            trigger: "change",
          },
        ],
        invoiceType: [
          {
            required: true,
            trigger: "change",
          },
        ],
        workType: [
          {
            required: true,
            trigger: "change",
          },
        ],
        warehouse: [
          {
            required: true,
            trigger: "change",
          },
        ],

        invCode: [
          {
            required: true,
            trigger: "change",
          },
        ],
        invName: [
          {
            required: true,
            trigger: "change",
          },
        ],
        quantity: [
          {
            validator: checkOutQuantity,
            required: true,
            trigger: "blur",
          },
        ],
        price: [
          {
            validator: checkOutPrice,
            required: true,
            trigger: "blur",
          },
        ],
      },
    };
  },
  props: {
    selectPrint: {
      //批量打印状态
      type: String,
      default: "",
    },
    BatchPrintData: {
      //批量打印对应数据
      type: Array,
      default() {
        return [];
      },
    },
  },
  created() {
    //初始化页面
    this.initialStatus = true;
    this.Initial();
  },
  activated() {
    //参数是否有值
    if (this.initialStatus == true) {
      this.initialStatus = false;
      return;
    }
    if (this.$route.query.open !== this.fmStatus) {
      this.Initial();
      return;
    }

    if (this.entry.seeCode !== this.$route.query.detailCode) {
      if (this.fmStatus == "seeStatus") {
        this.Initial();
        return;
      }
    }

    if (this.entryMode == true) {
      if (
        this.fmData.bredVouch !== this.$route.query.bredVouch ||
        this.fmData.workType !== this.$route.query.workType ||
        this.fmData.warehouse !== this.$route.query.whCode
      ) {
        this.Initial();
      } else if (
        this.$route.query.bredVouch == "" &&
        this.$route.query.workType == "" &&
        this.$route.query.whCode == ""
      ) {
        this.entryMode = false;
        this.Initial();
      }
    } else {
      if (
        this.$route.query.bredVouch != "" &&
        this.$route.query.workType != "" &&
        this.$route.query.whCode != ""
      ) {
        this.entryMode = true;
        this.Initial();
      }
    }
  },

  methods: {
    // 初始化页面
    Initial() {
      // 按钮状态
      this.fmStatus = this.$route.query.open;
      this.entry.setConfig = this.$route.query.fmConfig;
      if (this.fmStatus == "addStatus") {
        //新增状态重置表单
        this.objHelper.handleReset();
        //判断业务类型
      } else if (
        this.fmStatus == "seeStatus" ||
        this.fmStatus == "updateStatus"
      ) {
        this.entry.seeCode = this.$route.query.detailCode;
        seeMaster({
          wmCode: this.entry.seeCode,
        }).then((res) => {
          if (res.code == 200) {
            this.fmData = res.data;
            this.fmData.bredVouch = this.fmData.bredVouch.toString();
            if (this.fmData.workStatus == "1") {
              this.stack.commandIndex = "1";
            } else if (this.fmData.workStatus == "2") {
              this.stack.commandIndex = "2";
            } else {
              this.stack.commandIndex = "0";
            }
            if (
              this.fmData.workDept !== undefined &&
              this.fmData.workDept !== null &&
              this.fmData.workDept !== ""
            ) {
              listUser({
                deptId: this.fmData.workDept,
              }).then((res) => {
                this.enums.optionsworkStaff = res.rows;
              });
            }
            this.objUtils.getDecimal();
            if (this.fmStatus == "seeStatus") {
              this.option.disabledInput = true;
              this.option.wmworkStatus = true; //编辑状态下业务类型与仓库是否可选
            } else {
              this.option.disabledInput = false;
              if (this.entryMode == true) {
                this.option.wmworkStatus = true;
              } else {
                this.option.wmworkStatus = false;
              }
            }

            if (this.entryMode == false) {
              if (this.fmData.bredVouch == "0") {
                this.objHelper.getWorkType("wm_in_type").then(() => {
                  //初始化单据与业务信息
                  this.$nextTick(() => {
                    this.getDictionaryType();
                  });
                });
              } else if (this.fmData.bredVouch == "1") {
                this.objHelper.getWorkType("wm_reject_in").then(() => {
                  //初始化单据与业务信息
                  this.$nextTick(() => {
                    this.getDictionaryType();
                  });
                });
              } else {
                this.objHelper.getWorkType("wm_adjust_in").then(() => {
                  //初始化单据与业务信息
                  this.$nextTick(() => {
                    this.getDictionaryType();
                  });
                });
              }
            }
          }
        });
      }
      // 路由信息用于关闭页面
      this.entry.routeMsg = this.$route;
      // 进入表单模式，有参、无参
      if (
        this.$route.query.whCode !== "" &&
        this.$route.query.bredVouch !== "" &&
        this.$route.query.workType !== ""
      ) {
        this.entryMode = true; //参数有值时
        // 字典对应业务类型
        if (this.$route.query.bredVouch == 0) {
          this.objHelper.getWorkType("wm_in_type").then(() => {
            //初始化单据与业务信息
            this.$nextTick(() => {
              this.getDictionaryType();
            });
          });
        } else if (this.$route.query.bredVouch == 1) {
          this.objHelper.getWorkType("wm_reject_in").then(() => {
            //初始化单据与业务信息
            this.$nextTick(() => {
              this.getDictionaryType();
            });
          });
        } else {
          this.objHelper.getWorkType("wm_adjust_in").then(() => {
            //初始化单据与业务信息
            this.$nextTick(() => {
              this.getDictionaryType();
            });
          });
        }
      } else {
        this.entryMode = false; //参数无值时
        if (this.fmStatus == "addStatus") {
          this.objHelper.getWorkType("wm_in_type").then(() => {
            //初始化单据与业务信息
            this.$nextTick(() => {
              this.getDictionaryType();
            });
          });
        }
      }

      this.objMaterial.materialMaxHeight();
    },

    // 获取字典数据
    getDictionaryType() {
      const _self = this;
      _self.loading = true;
      //并行请求
      axios
        .all([
          dictMatching("wm_invoice_type"),
          dictMatching("sys_work_status"),
          listDept(),
          listWarehouses({
            bredVouch: this.$route.query.bredVouch,
            invoiceType: this.$route.query.invoiceType,
            workType: this.$route.query.workType,
          }),
        ])
        .then(
          axios.spread(function (resIvType, resWorkStatus, resDept, resHouses) {
            if (
              resIvType.code == 200 &&
              resDept.code == 200 &&
              resHouses.code == 200
            ) {
              // 单据类型
              _self.enums.optionsInvoiceType = resIvType.data;
              // 业务部门
              let arr = _self.handleTree(resDept.data, "deptId");
              _self.enums.optionsworkDept = getTreeData(arr);
              //仓库
              _self.enums.optionswarehouse = resHouses.rows;
              //业务状态
              _self.enums.optionsworkStatus = resWorkStatus.data;
              //新增状态下成功隐藏加载框
              if (_self.fmStatus == "addStatus") {
                if (_self.$route.query.whCode !== "") {
                  _self.objWarehouse.warehouseChange(_self.$route.query.whCode);
                }
                _self.loading = false;
                _self.fmData.invoiceDate = new Date();
                _self.fmData.userOper = _self.$store.getters.name;
              }

              // 查看/编辑数据
              if (
                (_self.fmStatus == "seeStatus" && _self.fmData !== null) ||
                _self.fmStatus == "updateStatus"
              ) {
                //业务类型
                _self.enums.selectworkType = _self.fmData.workType;
                _self.$refs.fmData.clearValidate();
                //仓库
                _self.enums.selectwarehouse = _self.fmData.warehouse;
                if (_self.fmData.workDept !== "") {
                  // 部门数据回显
                  _self.objHelper.undataAddSee(_self.fmData.workDept);
                }
                // 业务人员
                _self.enums.selectworkStaff = _self.fmData.workStaff;

                //记录蓝红/黄字
                _self.entry.recordBredVouch = _self.fmData.bredVouch;
                //匹配物料特殊属性物料信息导航名称/小数位数
                _self.objWarehouse.warehouseChange(_self.fmData.warehouse);
                _self.stack.workTypeStatus = true;
              }
            } else {
              _self.msgError("获取信息失败");
            }
          })
        );
    },

    //新增
    btnNew(fmData) {
      if (this.fmData.wmInSalveList.length == 0) {
        this.msgError("物料信息为空");
      } else {
        this.$refs.fmData.validate((valid) => {
          if (valid) {
            fmData.invoiceDate = this.parseTime(fmData.invoiceDate);
            fmData.formConfig = this.entry.setConfig;
            addMaster(fmData)
              .then((res) => {
                this.msgSuccess("新增成功");
                // 更新成功不刷新,重新赋值表单数据
                this.option.btnIsClick = true;
                this.$store.dispatch("stockStatus/setCheckinRefresh", true);
                this.fmStatus = "seeStatus";
                this.option.disabledInput = true;
                this.fmData = res.data;
                this.fmData.bredVouch = this.fmData.bredVouch.toString();
                this.option.wmworkStatus = true;
                this.objMaterial.materialMaxHeight();
                this.objUtils.getDecimal();
              })
              .catch((err) => {
                this.msgError("新增失败");
              });
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      }
    },

    // 保存
    btnSave(fmData) {
      if (this.fmData.wmInSalveList.length == 0) {
        this.msgError("物料信息为空");
      } else {
        this.$refs.fmData.validate((valid) => {
          if (valid) {
            fmData.invoiceStatus = "0";
            fmData.invoiceDate = this.parseTime(fmData.invoiceDate);
            updateMaster(fmData)
              .then((res) => {
                this.msgSuccess("更新成功");
                this.fmStatus = "seeStatus";
                this.option.disabledInput = true;
                this.$store.dispatch("stockStatus/setCheckinRefresh", true);
                this.fmData = res.data;
                this.fmData.bredVouch = this.fmData.bredVouch.toString();
                this.option.wmworkStatus = true;
                this.objMaterial.materialMaxHeight();
                this.objUtils.getDecimal();
              })
              .catch((err) => {
                this.msgError("更新失败");
              });
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      }
    },

    //查看->编辑
    btnEdit() {
      this.option.disabledInput = false;
      this.fmStatus = "updateStatus";
      this.option.btnIsClick = false;
      if (this.entryMode == true) {
        this.option.wmworkStatus = true;
      } else {
        this.option.wmworkStatus = false;
      }
      this.objMaterial.materialMaxHeight();
    },

    //查看->新增
    btnAdd(type) {
      if (type == "view") {
        this.$router.push({
          path: "/wm/stock/checkinadd",
          query: {
            open: "addStatus",
            whCode: this.enums.selectwarehouse,
            bredVouch: this.$route.query.bredVouch,
            invoiceType: this.$route.query.invoiceType,
            workType: this.$route.query.workType,
            fmConfig: this.$route.query.fmConfig,
          },
        });
      } else {
        this.fmStatus = "addStatus"; //按钮状态为新增
        this.option.disabledInput = false; //输入框可输入
        this.option.btnIsClick = false; //按钮状态为可点击
        this.enums.selectworkDept = ""; //清空部门选择
        this.enums.selectworkStaff = ""; //清空业务人员
        this.objHelper.handleReset(); //重置表单默认值
        if (this.$route.query.bredVouch !== "") {
          this.fmData.bredVouch = this.$route.query.bredVouch;
        } else {
          this.fmData.bredVouch = "0";
        }
        this.fmData.workType = this.enums.selectworkType; //赋值表单业务类型
        this.fmData.warehouse = this.enums.selectwarehouse; //赋值仓库
        if (this.fmData.bredVouch !== "1") {
          this.fmData.wmInSalveList.push({
            ...this.fmItem,
          });
        }
        this.enums.selectperiod =
          this.enums.optionsperiod[this.enums.optionsperiod.length - 1].period;
        this.fmData.period = this.objUtils.periodDirInt(
          this.enums.selectperiod
        );
        this.$refs.fmData.clearValidate();
      }
    },

    //编辑->撤回
    btnUndo() {
      this.option.disabledInput = true; //是否可编辑
      this.option.wmworkStatus = true;
      this.fmStatus = "seeStatus";
      this.option.disabledInput = true;
      this.$refs["tableClums"].doLayout();
      this.objMaterial.materialMaxHeight();
    },

    //新增->取消
    btnCancel() {
      const self = this;
      self.$store
        .dispatch("tagsView/delView", self.entry.routeMsg)
        .then(({ visitedViews }) => {
          let cancelFun = {
            isActive(route) {
              return route.path === self.$route.path;
            },
            toLastView(visitedViews, view) {
              const latestView = visitedViews.slice(-1)[0];
              if (latestView) {
                self.$router.push(latestView.fullPath);
              } else {
                if (view.name === "Dashboard") {
                  self.$router.replace({
                    path: "/redirect" + view.fullPath,
                  });
                } else {
                  self.$router.push("/");
                }
              }
            },
          };
          if (cancelFun.isActive(this.entry.routeMsg)) {
            cancelFun.toLastView(visitedViews, this.entry.routeMsg);
          }
        });
    },

    //审核
    btnCheck() {
      examineBill([{ wmCode: this.fmData.wmCode }]).then((res) => {
        if (res.code == 200) {
          this.fmData.invoiceStatus = "1";
          this.fmData.checkDate = res.data.checkDate;
          this.fmData.userCheck = res.data.userCheck;
          this.$store.dispatch("stockStatus/setCheckinRefresh", true);
          this.msgSuccess("审核成功");
        }
      });
    },

    //反审核
    btnUnCheck() {
      this.$confirm("确定撤销审核", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return examineDeBill([{ wmCode: this.fmData.wmCode }]);
        })
        .then((res) => {
          if (res.code == 200) {
            this.fmData.invoiceStatus = "2";
            this.fmData.checkDate = "";
            this.fmData.userCheck = "";
            this.$store.dispatch("stockStatus/setCheckinRefresh", true);
            this.msgSuccess("撤销成功");
          }
        });
    },

    // 上一条下一条
    btnForward(code, type) {
      if (type == "next") {
        this.option.stripStatus = true;
        NextInMaster({
          wmCode: code,
          workType: this.$route.query.workType,
          period: this.fmData.period,
          type: true,
        })
          .then((res) => {
            if (res.code == 200) {
              this.fmData = res.data;
              this.getDictionaryType();
              this.fmData.bredVouch = this.fmData.bredVouch.toString();
              this.objUtils.getDecimal();
              this.option.stripStatus = false;
            }
          })
          .catch((err) => {
            this.option.stripStatus = false;
          });
      } else {
        this.option.stripStatus = true;
        NextInMaster({
          wmCode: code,
          workType: this.$route.query.workType,
          period: this.fmData.period,
          type: false,
        })
          .then((res) => {
            if (res.code == 200) {
              this.fmData = res.data;
              this.fmData.bredVouch = this.fmData.bredVouch.toString();
              this.getDictionaryType();
              this.objUtils.getDecimal();
              this.option.stripStatus = false;
            }
          })
          .catch((err) => {
            this.option.stripStatus = false;
          });
      }
    },

    //操作
    btnOperation(value) {
      let data = {
        wmCode: this.fmData.wmCode,
        workStatus: value,
        version: this.fmData.version,
      };
      operationBill(data).then((res) => {
        if (res.code == 200) {
          this.fmData.workStatus = res.data.workStatus;
          this.stack.commandIndex = res.data.workStatus;
          this.fmData.version = res.data.version;
          this.msgSuccess("状态修改成功");
        }
      });
    },

    //物料
    classMaterial() {
      const self = this;
      return {
        // 物料信息最大高度
        materialMaxHeight() {
          if (`${document.documentElement.clientHeight}` - 460 < 400) {
            self.style.tableHeight = 500;
          } else {
            if (self.fmStatus == "seeStatus") {
              self.style.tableHeight =
                `${document.documentElement.clientHeight}` - 455;
            } else {
              self.style.tableHeight =
                `${document.documentElement.clientHeight}` - 435;
            }
          }
        },
        // 新增物料
        addMaterial() {
          self.stack.saveIndex = null;
          self.fmData.wmInSalveList.push({
            ...self.fmItem,
          });
        },

        // 获取物料数据
        getMaterialList() {
          self.stack.basicfileList = [];
          listMaterial(self.query).then((res) => {
            self.stack.basicfileList = res.rows;
          });
        },

        // 物料搜索
        searchCode(index, data) {
          self.stack.rowIndex = index;
          if (self.fmData.wmInSalveList[index].invCode !== "") {
            self.fmData.wmInSalveList[index].invName = "";
            self.fmData.wmInSalveList[index].invAttribute = "";
            self.fmData.wmInSalveList[index].unitName = "";
            self.query.code = self.fmData.wmInSalveList[index].invCode;
            // 获取配置分类下的物料
            if (self.stack.sortArrId.length > 0) {
              let root = self.stack.sortArrId.toString();
              self.query.sortRoot = root;
              this.getMaterialList();
            }
            self.stack.saveIndex = index;
          } else {
            self.stack.saveIndex = null;
          }
        },

        //当搜索物料只有一条物料信息回车键直接选择
        codeEnter() {
          if (self.stack.basicfileList.length == 1) {
            this.handleSelect(self.stack.basicfileList[0]);
            self.stack.saveIndex = null;
          }
        },

        // 物料搜索选择成功
        successSelect(data) {
          this.handleSelect(data);
          self.stack.saveIndex = null;
        },

        //物料选择
        btnItem(index) {
          self.stack.saveIndex = null;
          self.stack.selectDialog = true;
          self.stack.rowIndex = index;
        },

        //关闭物料搜索下拉
        handleHide() {
          self.stack.saveIndex = null;
        },

        //选择物料
        handleSelect(data) {
          self.stack.saveIndex = null;
          let selectObj = {
            invSortId: data[0].sortId,
            invCode: data[0].code,
            invName: data[0].name,
            invAttribute: data[0].attribute,
            unitName: data[0].unitName,
            unitCode: data[0].unitCode,
            batchNumber: "", //批号
            ppNumber: "",
            invSortRoot: data[0].sortRoot,
            price: self.option.priceStatus ? "" : "",
            quantity: "",
          };
          if (data[1] == false) {
            // 更新表单数据
            this.updateMaterial(data);
            this.selectClose();
          } else {
            if (data[2] == 1) {
              // 更新表单数据
              self.objMaterial.updateMaterial(data);
            } else {
              self.fmData.wmInSalveList.push({
                ...selectObj,
              });
            }
          }
        },

        //公共更新表格物料
        updateMaterial(data) {
          // 更新表单数据
          self.$set(self.fmData.wmInSalveList, self.stack.rowIndex, {
            invSortId: data[0].sortId,
            invCode: data[0].code,
            invName: data[0].name,
            invAttribute: data[0].attribute,
            unitName: data[0].unitName,
            unitCode: data[0].unitCode,
            batchNumber: "", //批号
            ppNumber: "",
            invSortRoot: data[0].sortRoot,
            price: self.option.priceStatus ? "" : "",
            quantity: "",
            woDate: null,
            woInvoice: "",
            woInvoiceId: "",
            woType: "",
            woTypeId: "",
            woCode: "",
            woUniqueId: 0,
            woConfig: "",
            woQuantity: "", //上游数量
          });
        },

        //选择物料弹框状态
        selectClose() {
          self.stack.selectDialog = false;
        },

        //选择引入物料
        handleImportMaterialSelect(code, index) {
          // console.log(index)
          self.stack.ImportMaterialStatus = true;
          self.stack.ImportMaterialCode.workType = self.$route.query.workType;
          self.stack.ImportMaterialCode.warehouse =
            self.$route.query.entry.whCode;
          self.$refs.fmData.clearValidate();
        },

        handdleAddImport(list) {
          return new Promise((resolve, reject) => {
            let materialDate = {
              invSortRoot: "",
              invSortId: "",
              invCode: "",
              invName: "",
              invAttribute: "",
              unitName: "",
              unitCode: "",
              batchNumber: "", //批号
              ppNumber: "",
              quantity: "",
              f1: "",
              f2: "",
              f3: "",
              f4: "",
              f5: "",
              location: "",
              remarks: "",
            };
            let successList = JSON.parse(JSON.stringify(list)),
              formMaterial = []; //赋值物料信息
            successList.forEach((item, i) => {
              formMaterial.push({
                ...materialDate,
              });
            });
            resolve(formMaterial);
          });
        },

        //选择成功
        handleImportMaterialSuccess(list) {
          this.handdleAddImport(list).then((arr) => {
            let successList = JSON.parse(JSON.stringify(list));
            if (successList.length > 0) {
              for (let i = 0; i < successList.length; i++) {
                arr[i].invSortId = successList[i].inv_sort_id;
                arr[i].invSortRoot = successList[i].inv_sort_root;
                arr[i].invCode = successList[i].inv_code;
                arr[i].invName = successList[i].inv_name;
                arr[i].unitName = successList[i].unit_name;
                arr[i].unitCode = successList[i].unit_code;
                arr[i].batchNumber = successList[i].batch_number;
                arr[i].ppNumber = successList[i].pp_number;
                arr[i].quantity = successList[i].amountReceived;
                arr[i].location = successList[i].location;
                arr[i].invAttribute = successList[i].inv_attribute;
                arr[i].remarks = successList[i].remarks;
                if (successList[i].f1) {
                  arr[i].f1 = successList[i].f1;
                }
                if (successList[i].f2) {
                  arr[i].f2 = successList[i].f2;
                }
                if (successList[i].f3) {
                  arr[i].f3 = successList[i].f3;
                }
                if (successList[i].f4) {
                  arr[i].f4 = successList[i].f4;
                }
                if (successList[i].f5) {
                  arr[i].f5 = successList[i].f5;
                }
              }
              self.fmData.workDept = successList[0].work_dept;
              if (self.fmData.workDept !== "") {
                // 部门数据回显
                self.objHelper.undataAddSee(self.fmData.workDept);
              }
              // 赋值单据主体
              self.fmData.workStaff = successList[0].work_staff;
              self.enums.selectworkStaff = successList[0].work_staff;
              self.fmData.customer = successList[0].customer;
              self.fmData.customerId = successList[0].customer_id;
              self.fmData.omCode = successList[0].om_code;
              self.fmData.productionLine = successList[0].production_line;
              self.fmData.productionLineId = successList[0].production_line_id;
              self.fmData.outSource = successList[0].outsource;
              self.fmData.outSourceId = successList[0].outsource_id;
              self.fmData.otCode = successList[0].ot_code;
            }
            self.fmData.wmInSalveList = [];
            self.fmData.wmInSalveList.push(...arr);
          });
        },

        // 关闭引入组件/
        selectImportMaterialClose() {
          self.stack.ImportMaterialStatus = false;
        },

        //删除
        deleteList(index) {
          self.$message({
            message: "删除成功",
            duration: 1000,
          });
          self.fmData.wmInSalveList.splice(index, 1);
          self.stack.saveIndex = null;
        },
      };
    },

    //仓库
    classWarehouse() {
      const self = this;
      return {
        //仓库选择 */
        warehouseChange(value) {
          //新增状态下重新选择仓库时清空物料
          if (self.fmStatus == "addStatus") {
            self.objHelper.resetInput();
          }
          //仓库回显名称
          self.enums.selectwarehouse = value;
          self.fmData.warehouse = value;
          this.WarehouseCheck(value).then((res) => {
            if (self.selectPrint == "success") {
              self.objPrinter.handlePrint();
            }
          });
          //获取仓库分类信息
          let wmObj = {};
          wmObj = self.enums.optionswarehouse.find((item) => {
            return item.code == value;
          });
          let wmArr = wmObj.sortId.split(",");
          // 隐藏物料编码搜索
          self.stack.saveIndex = null;
          self.stack.sortArrId = wmArr;

          //获取可用期间
          blanceAvailable({ whCode: value }).then((res) => {
            // console.log(res);
            let periodList = JSON.parse(JSON.stringify(res.data));
            if (periodList.length > 0) {
              periodList.forEach((item) => {
                item.period = self.objUtils.periodDirStr(item.period);
              });
              self.enums.optionsperiod = periodList;
            } else {
              self.enums.optionsperiod = [];
            }
            if (self.fmStatus == "addStatus") {
              self.enums.selectperiod =
                self.enums.optionsperiod[
                  self.enums.optionsperiod.length - 1
                ].period;
              self.fmData.period = self.objUtils.periodDirInt(
                self.enums.selectperiod
              );
            } else {
              self.enums.selectperiod = self.objUtils.periodDirStr(
                self.fmData.period
              );
            }
          });
          self.fmData.warehouse = value;
        },
        WarehouseCheck(d) {
          return new Promise((resolve, reject) => {
            // 仓库配置
            let houseMsg = null;
            self.enums.optionswarehouse.forEach((item) => {
              if (item.code == d) {
                houseMsg = item;
              }
            });
            if (houseMsg !== null) {
              if (houseMsg.configMap !== null) {
                if (houseMsg.configMap["precision.quantity"] !== "null") {
                  self.fmConfig.decimalQuantity =
                    houseMsg.configMap["precision.quantity"];
                }

                if (houseMsg.configMap["precision.price"] !== "null") {
                  self.fmConfig.decimalPrice =
                    houseMsg.configMap["precision.price"];
                }
                // 合并规格
                if (houseMsg.configMap["inv.attr.merge"] !== "null") {
                  self.fmConfig.attrMerge =
                    houseMsg.configMap["inv.attr.merge"];
                }
                //规格别名
                if (houseMsg.configMap["inv.attr.alias"] !== "null") {
                  self.fmConfig.attrAlias =
                    houseMsg.configMap["inv.attr.alias"];
                }

                //特殊属性
                if (houseMsg.configMap["inv.property"] !== "null") {
                  self.fmConfig.property =
                    houseMsg.configMap["inv.property"].split(",");
                }
              } else {
                self.objHelper.resetFmConfig();
              }
              self.entry.setConfig = houseMsg.formConfig;

              //仓库名称
              self.stack.whName = houseMsg.name;
              if (houseMsg.enableLocation == 1) {
                self.stack.locationStatus = true;
              } else {
                self.stack.locationStatus = false;
              }
            }
            if (
              self.fmStatus == "seeStatus" ||
              self.fmStatus == "updateStatus"
            ) {
              self.fmData.wmInSalveList.forEach((item) => {
                if (item.price !== null) {
                  item.price = parseFloat(item.price).toFixed(
                    self.fmConfig.decimalPrice
                  );
                }
                if (item.quantity !== null) {
                  item.quantity = parseFloat(item.quantity).toFixed(
                    self.fmConfig.decimalQuantity
                  );
                }
                if (item.amount !== null) {
                  item.amount = parseFloat(item.amount).toFixed(2);
                }
              });
            }

            // 业务类型选择根据仓库类型回显
            if (
              (self.entryMode == false && self.fmData.bredVouch == "0") ||
              (self.entryMode == false && self.fmData.bredVouch == "1")
            ) {
              self.enums.optionsworkType = [];
              let type = houseMsg.inType.split(",");
              type.forEach((id) => {
                let objType = self.enums.workTypeInit.find((item) => {
                  return item.dictValue == id;
                });
                self.enums.optionsworkType.push(objType);
              });
            }
            if (self.fmStatus == "addStatus") {
              self.fmData.wmInSalveList = [];
              self.stack.workTypeStatus = true;
              if (self.entryMode == false) {
                self.enums.selectworkType =
                  self.enums.optionsworkType[0].dictValue;
                self.fmData.workType = self.enums.optionsworkType[0].dictValue;
              }
              if (self.fmData.bredVouch !== "1") {
                self.fmData.wmInSalveList.push({
                  ...self.fmItem,
                });
              }
            }

            self.loading = false;
            // 延迟显示物料信息优化体验
            setTimeout(() => {
              self.$refs["tableClums"].doLayout();
              self.option.parametersStatus = true;
            }, 50);

            resolve();
          });
        },
      };
    },

    //供方/设备/客户
    classFilling() {
      const self = this;
      return {
        //获取供方
        getSupplierlList(data) {
          listSupplier({
            name: data,
            status: "0",
          }).then((res) => {
            if (res.code == 200) {
              self.stack.poSearchStatus = true;
              self.enums.optionssupplier = res.rows;
            }
          });
        },

        //供方组件关闭
        selectSupplierClose() {
          self.stack.poStatus = false;
        },

        // 供方组件选择成功
        handleSupplierSelect(row) {
          self.fmData.supplier = row.name;
          self.fmData.supplierId = row.uniqueId;
          self.stack.poStatus = false;
        },

        //获取客户
        getCustomerList(data) {
          listCustomer({
            name: data,
            status: "0",
          }).then((res) => {
            if (res.code == 200) {
              self.stack.omSearchStatus = true;
              self.enums.optionscustomer = res.rows;
            }
          });
        },

        //获取生产商
        getOutsourceList(data) {
          listOutsource({
            name: data,
            status: "0",
          }).then((res) => {
            if (res.code == 200) {
              self.stack.puSearchStatus = true;
              self.enums.optionsoutsource = res.rows;
            }
          });
        },

        //获取设备
        getProductionLin() {
          listEquipment().then((res) => {
            self.enums.optionsproductionLine = res.rows;
          });
        },

        // 加工设备/生产商（委外厂家）/供方/选择
        handlePoPuPrs(type) {
          if (type == "prs") {
            //加工设备
            this.getProductionLin(); //获取设备
            self.stack.prsStatus = true;
          } else if (type == "om") {
            //客户
            self.stack.omStatus = true;
          } else if (type == "po") {
            //供应商
            self.stack.poStatus = true;
          } else if (type == "pu") {
            //外协
            self.stack.puStatus = true;
          }
        },

        // 客户组件关闭
        selectCustomerClose() {
          self.stack.omStatus = false;
        },

        //客户组件选择成功
        handleCustomerSelect(row) {
          self.fmData.customer = row.name;
          self.fmData.customerId = row.uniqueId;
          self.stack.omStatus = false;
        },

        //生产商（外协厂家）关闭
        selectOutsourceClose() {
          self.stack.puStatus = false;
        },

        // 生产商（外协厂家）选择成功
        handleOutsourceSelect(row) {
          self.fmData.outSource = row.name;
          self.fmData.outSourceId = row.uniqueId;
          self.stack.puStatus = false;
        },

        //选择成功
        successPoPuPrs(data, type) {
          if (type == "prs") {
            //加工设备
            self.fmData.productionLine = data.name;
            self.fmData.productionLineId = data.code;
            // 改变部门选择
            self.objUtils.resetSelector(); //级联选择器回显Bug
            self.objHelper.undataAddSee(data.deptId); //部门回显
            self.fmData.workStaff = "";
            self.enums.selectworkStaff = "";
            self.fmData.workDept = data.deptId;
            listUser({
              //查询部门人员
              deptId: data.deptId,
            }).then((res) => {
              self.enums.optionsworkStaff = res.rows;
            });
            self.stack.prsStatus = false;
          } else if (type == "poSearch") {
            self.fmData.supplier = data.name;
            self.fmData.supplierId = data.code;
            self.stack.poSearchStatus = false;
          } else if (type == "puSearch") {
            self.fmData.outSource = data.name;
            self.fmData.outSourceId = data.code;
            self.stack.puSearchStatus = false;
          } else if (type == "omSearch") {
            self.fmData.customer = data.name;
            self.fmData.customerId = data.code;
            self.stack.omSearchStatus = false;
          }
        },

        //搜索
        searchPoPuPrs(data, type) {
          if (type == "poSearch") {
            this.getSupplierlList(data);
          } else if (type == "puSearch") {
            this.getOutsourceList(data);
          } else if (type == "omSearch") {
            this.getCustomerList(data);
          }
        },

        //搜索条数为1
        nameEnter(data, type) {
          if (type == "poSearch" && self.enums.optionssupplier.length == 1) {
            this.successPoPuPrs(self.enums.optionssupplier[0], type);
          } else if (
            type == "puSearch" &&
            self.enums.optionsoutsource.length == 1
          ) {
            this.successPoPuPrs(self.enums.optionsoutsource[0], type);
          } else if (
            type == "omSearch" &&
            self.enums.optionscustomer.length == 1
          ) {
            this.successPoPuPrs(self.enums.optionscustomer[0], type);
          }
        },

        // 关闭
        handleClosePoPuPrs(type) {
          if (type == "prs") {
            self.stack.prsStatus = false;
          } else if (type == "poSearch") {
            self.stack.poSearchStatus = false;
          } else if (type == "puSearch") {
            self.stack.puSearchStatus = false;
          } else if (type == "omSearch") {
            self.stack.omSearchStatus = false;
          }
        },
      };
    },

    //货位
    classLocation() {
      const self = this;
      return {
        // 选择货位
        locationChange(index) {
          self.stack.rowIndex = index;
          self.stack.isLocation = true;
        },
        //货位组件关闭
        selectLocationClose() {
          self.stack.isLocation = false;
        },

        //选择货位成功
        handleLocationSelect(data) {
          self.fmData.wmInSalveList[self.stack.rowIndex].location =
            data.postName;

          self.stack.isLocation = false;
        },
      };
    },

    //引入
    classLeadin() {
      const self = this;
      return {
        //采购入库引入
        btnPurchaseCheckin() {
          self.stack.purchaseCheckinStatus = true;
        },
        purchaseCheckinImport(list) {
          return new Promise((resolve, reject) => {
            let materialDate = {
              invSortId: "", //物料分类
              invCode: "", //物料编码
              invName: "", //物料名称
              invAttribute: "", //型号规格
              unitCode: "", //主计量
              unitName: "", //主计量
              batchNumber: "", //批号
              ppNumber: "", //销售订单号
              quantity: "", //数量
              price: "", //单价
              amount: 0.0, //金额
              f1: "",
              f2: "",
              f3: "",
              f4: "",
              f5: "",
              location:"",
              woInvoice: "",
              woInvoiceId: "",
              woType: "",
              woTypeId: "",
              woCode: "",
              woConfig: "",
              woDate: null,
              woUniqueId: "",
              woQuantity: "",
              remarks: "", //备注
            };
            let successList = JSON.parse(JSON.stringify(list)),
              formMaterial = []; //赋值物料信息
            successList.forEach((item, i) => {
              formMaterial.push({
                ...materialDate,
              });
            });

            resolve(formMaterial);
          });
        },

        // 选择采购入库引入物料成功
        handlePurchaseCheckinSuccess(list) {
          self.fmData.wmInSalveList = [];
          this.purchaseCheckinImport(list[1]).then((arr) => {
            let successList = JSON.parse(JSON.stringify(list[1]));
            if (successList.length > 0) {
              for (let i = 0; i < successList.length; i++) {
                arr[i].invSortRoot = successList[i].inv_sort_root;
                arr[i].invSortId = successList[i].inv_sort_id;
                arr[i].invCode = successList[i].inv_code;
                arr[i].invName = successList[i].inv_name;
                arr[i].unitName = successList[i].unit_name;
                arr[i].unitCode = successList[i].unit_code;
                arr[i].batchNumber = successList[i].batch_number;
                arr[i].ppNumber = successList[i].pp_number;
                arr[i].invAttribute = successList[i].inv_attribute;
                arr[i].quantity = successList[i].surplus;
                arr[i].price = successList[i].price || "0.00";
                arr[i].amount = successList[i].price * successList[i].surplus;
                arr[i].remarks = successList[i].remarks;
                arr[i].woDate = successList[i].invoiceDate;
                arr[i].woInvoice = successList[i].invoice_type;
                arr[i].woInvoiceId = successList[i].invoice_type_id;
                arr[i].woType = successList[i].work_type;
                arr[i].woTypeId = successList[i].work_type_id;
                arr[i].woCode = successList[i].po_code;
                arr[i].woConfig = successList[i].form_config;
                arr[i].woUniqueId = successList[i].unique_id;
                arr[i].woQuantity = successList[i].surplus; //上游数量
                if (successList[i].f1) {
                  arr[i].f1 = successList[i].f1;
                }
                if (successList[i].f2) {
                  arr[i].f2 = successList[i].f2;
                }
                if (successList[i].f3) {
                  arr[i].f3 = successList[i].f3;
                }
                if (successList[i].f4) {
                  arr[i].f4 = successList[i].f4;
                }
                if (successList[i].f5) {
                  arr[i].f5 = successList[i].f5;
                }
              }
            }

            self.fmData.supplier = list[0][0].supplier;
            self.fmData.supplierId = list[0][0].supplier_id;
            self.fmData.poCheckinCode = list[0][0].po_code;
            // 供方输入状态
            self.stack.supplierStatus = true;
            self.fmData.wmInSalveList.push(...arr);
            self.objUtils.getDecimal();
          });
        },
        purchaseCheckinClose() {
          self.stack.purchaseCheckinStatus = false;
        },

        //生产入库引入
        btnPrsCheckin() {
          self.stack.prsCheckinStatus = true;
        },
        prsCheckinImport(list) {
          return new Promise((resolve, reject) => {
            let materialDate = {
              invSortRoot: "",
              invSortId: "", //物料分类
              invCode: "", //物料编码
              invName: "", //物料名称
              invAttribute: "", //型号规格
              unitCode: "", //主计量
              unitName: "", //主计量
              batchNumber: "", //批号
              ppNumber: "",
              quantity: "", //数量
              price: "", //单价
              amount: 0.0, //金额
              f1: "",
              f2: "",
              f3: "",
              f4: "",
              f5: "",
               location:"",
              beltline: "",
              beltlineId: "",
              woInvoice: "",
              woInvoiceId: "",
              woType: "",
              woTypeId: "",
              woCode: "",
              woConfig: "",
              woDate: null,
              woUniqueId: "",
              woQuantity: "",
              remarks: "", //备注
            };
            let successList = JSON.parse(JSON.stringify(list)),
              formMaterial = []; //赋值物料信息
            successList.forEach((item, i) => {
              formMaterial.push({
                ...materialDate,
              });
            });
            resolve(formMaterial);
          });
        },

        // 选择生产入库引入物料成功
        handlePrsCheckinSuccess(list) {
          self.fmData.wmInSalveList = [];
          this.prsCheckinImport(list[1]).then((arr) => {
            let successList = JSON.parse(JSON.stringify(list[1]));
            if (successList.length > 0) {
              for (let i = 0; i < successList.length; i++) {
                arr[i].invSortRoot = successList[i].inv_sort_root;
                arr[i].invSortId = successList[i].inv_sort_id;
                arr[i].invCode = successList[i].inv_code;
                arr[i].invName = successList[i].inv_name;
                arr[i].unitName = successList[i].unit_name;
                arr[i].unitCode = successList[i].unit_code;
                arr[i].batchNumber = successList[i].batch_number;
                arr[i].ppNumber = successList[i].pp_number;
                arr[i].invAttribute = successList[i].inv_attribute;
                arr[i].quantity = successList[i].surplus || "0.00";
                arr[i].price = successList[i].price || "0.00";
                arr[i].amount =
                  parseFloat(arr[i].price) * parseFloat(arr[i].quantity);
                arr[i].remarks = successList[i].remarks;
                arr[i].beltline = successList[i].beltline || "";
                arr[i].beltlineId = successList[i].beltline_id || "";
                arr[i].woDate = successList[i].invoiceDate;
                arr[i].woInvoice = successList[i].invoice_type;
                arr[i].woInvoiceId = successList[i].invoice_type_id;
                arr[i].woType = successList[i].work_type;
                arr[i].woTypeId = successList[i].work_type_id;
                arr[i].woCode = successList[i].po_code;
                arr[i].woConfig = successList[i].form_config;
                arr[i].woUniqueId = successList[i].unique_id;
                arr[i].woQuantity = successList[i].surplus; //上游数量
                if (successList[i].f1) {
                  arr[i].f1 = successList[i].f1;
                }
                if (successList[i].f2) {
                  arr[i].f2 = successList[i].f2;
                }
                if (successList[i].f3) {
                  arr[i].f3 = successList[i].f3;
                }
                if (successList[i].f4) {
                  arr[i].f4 = successList[i].f4;
                }
                if (successList[i].f5) {
                  arr[i].f5 = successList[i].f5;
                }
              }
            }
            self.fmData.prsCheckinCode = list[0][0].prs_code;
            self.fmData.productionWorkshop = list[0][0].workTypeCn;
            self.fmData.productionWorkshopId = list[0][0].work_type;
            self.fmData.wmInSalveList.push(...arr);
            self.objUtils.getDecimal();
          });
        },

        //关闭
        prsCheckinClose() {
          self.stack.prsCheckinStatus = false;
        },

        //销售退货引入
        btnOmReject() {
          self.stack.omRejectStatus = true;
        },
        omRejectImport(list) {
          return new Promise((resolve, reject) => {
            let materialDate = {
              invSortId: "", //物料分类
              invCode: "", //物料编码
              invName: "", //物料名称
              invAttribute: "", //型号规格
              unitCode: "", //主计量
              unitName: "", //主计量
              batchNumber: "", //批号
              ppNumber: "",
              quantity: "", //数量
              price: "", //单价
               location:"",
              amount: 0.0, //金额
              f1: "",
              f2: "",
              f3: "",
              f4: "",
              f5: "",
              woInvoice: "",
              woInvoiceId: "",
              woType: "",
              woTypeId: "",
              woCode: "",
              woConfig: "",
              woDate: null,
              woUniqueId: "",
              woQuantity: "",
              remarks: "", //备注
            };
            let successList = JSON.parse(JSON.stringify(list)),
              formMaterial = []; //赋值物料信息
            successList.forEach((item, i) => {
              formMaterial.push({
                ...materialDate,
              });
            });
            resolve(formMaterial);
          });
        },

        // 选择销售退货引入物料成功
        handleOmRejectSuccess(list) {
          console.log(list);
          self.fmData.wmInSalveList = [];
          this.omRejectImport(list[1]).then((arr) => {
            let successList = JSON.parse(JSON.stringify(list[1]));
            if (successList.length > 0) {
              for (let i = 0; i < successList.length; i++) {
                arr[i].invSortRoot = successList[i].inv_sort_root;
                arr[i].invSortId = successList[i].inv_sort_id;
                arr[i].invCode = successList[i].inv_code;
                arr[i].invName = successList[i].inv_name;
                arr[i].unitName = successList[i].unit_name;
                arr[i].unitCode = successList[i].unit_code;
                arr[i].batchNumber = successList[i].batch_number;
                arr[i].ppNumber = successList[i].pp_number;
                arr[i].invAttribute = successList[i].inv_attribute;
                arr[i].quantity = successList[i].surplus;
                arr[i].price = successList[i].price || "0.00";
                arr[i].amount = successList[i].price * successList[i].surplus;
                arr[i].remarks = successList[i].remarks;
                arr[i].woDate = successList[i].invoiceDate;
                arr[i].woInvoice = successList[i].invoice_type;
                arr[i].woInvoiceId = successList[i].invoice_type_id;
                arr[i].woType = successList[i].work_type;
                arr[i].woTypeId = successList[i].work_type_id;
                arr[i].woCode = successList[i].po_code;
                arr[i].woConfig = successList[i].form_config;
                arr[i].woUniqueId = successList[i].unique_id;
                arr[i].woQuantity = successList[i].surplus; //上游数量
                if (successList[i].f1) {
                  arr[i].f1 = successList[i].f1;
                }
                if (successList[i].f2) {
                  arr[i].f2 = successList[i].f2;
                }
                if (successList[i].f3) {
                  arr[i].f3 = successList[i].f3;
                }
                if (successList[i].f4) {
                  arr[i].f4 = successList[i].f4;
                }
                if (successList[i].f5) {
                  arr[i].f5 = successList[i].f5;
                }
              }
            }
            self.fmData.prsCheckinCode = list[0][0].prs_code;
            self.fmData.wmInSalveList.push(...arr);
            self.objUtils.getDecimal();
          });
        },

        //关闭
        omRejectClose() {
          self.stack.omRejectStatus = false;
        },
      };
    },

    //助手
    classHelper() {
      const self = this;
      return {
        //  业务类型选择
        workTypeChange(value) {
          self.fmData.workType = value;
          self.stack.workTypeStatus = true;
          self.stack.prsStatus = false;
          self.stack.puSearchStatus = false;
          self.stack.poSearchStatus = false;
          self.stack.omSearchStatus = false;
          //清空采购/委外已填写订单号等信息,防止页面缓存
          self.fmData.customer = "";
          self.fmData.customerId = "";
          self.fmData.supplier = "";
          self.fmData.supplierId = "";
          self.fmData.productionLine = "";
          self.fmData.productionLineId = "";
          self.fmData.outSource = "";
          self.fmData.outSourceId = "";
        },

        // 业务部门选择
        workDeptChange(value) {
          let deptId = JSON.parse(JSON.stringify(value)); //防止干扰级联选择器
          self.fmData.workDept = deptId.pop();
          self.enums.selectworkStaff = "";
          self.fmData.workStaff = "";
          listUser({
            deptId: self.fmData.workDept,
          }).then((res) => {
            self.enums.optionsworkStaff = res.rows;
          });
        },

        // 业务人员选择
        workStaffChange(value) {
          self.fmData.workStaff = self.enums.selectworkStaff;
        },

        //期间
        periodChange(value) {
          self.fmData.period = self.objUtils.periodDirInt(value);
        },

        //字典类型
        getWorkType(type) {
          return new Promise((resolve, reject) => {
            dictMatching(type).then((res) => {
              self.enums.optionsworkType = [];
              self.enums.optionsworkType = res.data;
              // console.log(self.enums.optionsworkType);
              self.enums.workTypeInit = res.data;
              if (self.$route.query.bredVouch == "") {
                if (self.fmStatus == "addStatus") {
                  self.enums.selectworkType =
                    self.enums.optionsworkType[0].dictValue;
                  self.fmData.workType =
                    self.enums.optionsworkType[0].dictValue;
                }
              } else {
                self.enums.selectworkType =
                  self.enums.optionsworkType[
                    self.$route.query.workType
                  ].dictValue;
                self.fmData.workType =
                  self.enums.optionsworkType[
                    self.$route.query.workType
                  ].dictValue;
              }
              resolve(res);
            });
          });
        },

        //点击新增/查看新增重置表单
        handleReset() {
          //数据表单
          self.fmData = {
            invoiceDate: new Date(), //单据日期
            invoiceStatus: "0", //单据状态
            invoiceType: "0", //单据类型
            workStatus: "0", //业务状态
            bredVouch:
              self.entry.recordBredVouch || self.$route.query.bredVouch || "0", //红字蓝字
            workType: "", //业务类型
            warehouse: "", //仓库
            userOper: self.$store.getters.name,
            workDept: "", //业务部门
            workStaff: "", //业务人员
            period: "", //期间
            remarks: "", //备注
            supplier: "", //供方
            supplierId: "", //供方
            outsource: "", //外协厂家
            outsourceId: "", //外协厂家
            productionLine: "",
            productionLineId: "",
            customer: "", //销售客户
            customerId: "", //销售客户
            poCheckinCode: "", //采购到货单号
            puCheckinCode: "", //委外到货单号
            prsCheckinCode: "", //生产到货单号
            omRejectCode: "", //销售退货单号
            productionWorkshop: "", //加工车间
            productionWorkshopId: "", //加工车间id
            prsRejectCode: "", //生产退料单编码
            puRejectCode: "", //委外退料单编码
            wmInSalveList: [],
          };

          self.enums.selectworkStaff = "";
          /* 初始化红蓝黄字 */
          let bredVouch;
          if (self.$route.query.bredVouch) {
            bredVouch = self.$route.query.bredVouch.toString();
            self.fmData.bredVouch = bredVouch;
          } else {
            self.fmData.bredVouch = "0";
          }

          /* 初始化状态 */
          self.option.disabledInput = false;
          self.option.wmworkStatus = false;
          self.option.btnIsClick = false;
          self.enums.selectworkDept = "";
          self.workStaff = "";
        },

        //部门数据回显
        undataAddSee(id) {
          return new Promise((resolve, reject) => {
            let parentArr = [], //用于储存父类部门信息
              childrenArr = []; //用于储存子类部门信息
            getEcho(
              id,
              self.enums.optionsworkDept,
              parentArr,
              childrenArr
            ).then((res) => {
              setTimeout(() => {
                let success = [];
                for (let i = 0; i < res.length; i++) {
                  if (success.indexOf(res[i]) === -1) {
                    success.push(res[i]);
                  }
                }
                let getNode = JSON.parse(JSON.stringify(success)); //拷贝vuex信息，避免影响源数据
                getNode.forEach((v) => {
                  if (v.ancestors.indexOf(",") > -1) {
                    //是否是子部门
                    v.ancestors = v.ancestors.split(",").length; //拼接数组长度，用于排序
                  } else {
                    v.ancestors = 1;
                  }
                });
                getNode.sort((a, b) => {
                  //排序得到正常的部门顺序
                  return a.ancestors - b.ancestors;
                });
                self.enums.selectworkDept = [];
                self.print.printWorkDept = [];
                getNode.forEach((code) => {
                  self.enums.selectworkDept.push(code.deptId);
                  self.print.printWorkDept.push(code.deptName);
                });
              }, 0);
            });
            resolve();
          });
        },

        //重置物料
        resetInput() {
          if (self.fmData.wmInSalveList.length > 0) {
            self.fmData.wmInSalveList.forEach((res) => {
              Object.keys(res).forEach(function (key) {
                key, (res[key] = "");
              });
            });
          }
        },

        //重置表单参数
        resetFmConfig() {
          self.fmConfig = {
            //数量小数位数
            decimalQuantity: "2",
            //单价小数位数
            decimalPrice: "2",
            //规格合并
            attrMerge: "false",
            //规格别名
            attrAlias: "型号规格",
            //隐藏字段
            fieldHiding: [],
            //特殊属性
            property: [],
          };
        },

        //收起
        downToggle() {
          self.stack.saveIndex = null;
          if (self.style.downTitle == "收起") {
            self.style.downTitle = "展开";
          } else {
            self.style.downTitle = "收起";
          }
          self.style.isToggle = !self.style.isToggle;
          if (self.style.isToggle == false) {
            self.style.tableHeight = parseInt(self.style.tableHeight) + 170;
          } else {
            self.style.tableHeight =
              `${document.documentElement.clientHeight}` - 440;
          }
        },
      };
    },

    //打印
    classPrinter() {
      const self = this;
      return {
        //打印
        handlePrint() {
          let transferData = JSON.parse(JSON.stringify(self.fmData));
          //业务类型
          self.enums.workTypeInit.forEach((obj) => {
            if (obj.dictValue == transferData.workType) {
              transferData.workTypeTran = obj.dictLabel + "单";
            }
          });
          // 仓库
          let warehouse = self.enums.optionswarehouse.find((obj) => {
            return transferData.warehouse == obj.code;
          });
          transferData.warehouse = warehouse.name;
          //部门
          transferData.workDept = self.print.printWorkDept.join("/");
          self.print.printData = transferData;
          let number = 1;
          self.print.printData.wmInSalveList.forEach((obj) => {
            obj.id = number++;
          });
          self.print.printData.printTime = self.parseTime(new Date());
          self.print.printStatus = true;

          setTimeout(() => {
            this.getTitle().then(() => {
              self.$print(self.$refs.startPrint.$refs.print);
            });
          }, 50);
        },
        //获取模块参数中对应的打印标题
        getTitle() {
          return new Promise((resolve) => {
            moduleParameters({
              moduleId: "sys",
            })
              .then((res) => {
                if (res.code == 200) {
                  const obj = res.rows.find((item) => {
                    return item.configKey == "sys.title.print";
                  });
                  self.print.printTitle = obj.configValue;
                  resolve();
                }
              })
              .catch(() => {
                self.msgError("获取模块参数失败");
              });
          });
        },
      };
    },

    //工具
    classUtils() {
      const self = this;
      return {
        /** 格式化用户输入价格单价小数位数 */
        formatDecimal(index, data) {
          if (
            self.fmData.wmInSalveList[index].price !== "" &&
            isAccord(self.fmData.wmInSalveList[index].price)
          ) {
            let price = self.fmData.wmInSalveList[index].price;
            self.fmData.wmInSalveList[index].price = parseFloat(price).toFixed(
              self.fmConfig.decimalPrice
            );
          }
          if (
            self.fmData.wmInSalveList[index].quantity !== "" &&
            isAccord(self.fmData.wmInSalveList[index].quantity)
          ) {
            let quantity = self.fmData.wmInSalveList[index].quantity;
            self.fmData.wmInSalveList[index].quantity = parseFloat(
              quantity
            ).toFixed(self.fmConfig.decimalQuantity);
          }
          if (
            self.fmData.wmInSalveList[index].price !== "" &&
            self.fmData.wmInSalveList[index].quantity !== "" &&
            isAccord(self.fmData.wmInSalveList[index].price) &&
            isAccord(self.fmData.wmInSalveList[index].quantity)
          ) {
            self.fmData.wmInSalveList[index].amount = (
              self.fmData.wmInSalveList[index].price *
              self.fmData.wmInSalveList[index].quantity
            ).toFixed(2);
          } else {
            self.fmData.wmInSalveList[index].amount = "0.00";
          }
        },

        /** 数量单价金额小数位数*/
        getDecimal() {
          self.fmData.wmInSalveList.forEach((item) => {
            if (item.price !== null) {
              item.price = parseFloat(item.price).toFixed(
                self.fmConfig.decimalPrice
              );
            }
            if (item.quantity !== null) {
              item.quantity = parseFloat(item.quantity).toFixed(
                self.fmConfig.decimalQuantity
              );
            }
            if (item.amount !== null) {
              item.amount = parseFloat(item.amount).toFixed(2);
            }
          });
        },

        //时间格式转换
        inMaterTime(date) {
          let time = new Date(date);
          return (
            time.getFullYear() +
            "-" +
            (time.getMonth() + 1) +
            "-" +
            time.getDate() +
            " " +
            time.getHours() +
            ":" +
            time.getMinutes() +
            ":" +
            time.getSeconds()
          );
        },

        //期间转换
        periodDirInt(data) {
          let arr = data.split("-");
          let int = parseInt(arr.join(""));
          return int;
        },
        periodDirStr(data) {
          let time = data.toString();
          let y = time.slice(0, 4),
            m = time.slice(4, 6),
            str = y + "-" + m;
          return str;
        },

        //解决级联选择器回显高亮异常问题
        resetSelector() {
          if (self.$refs.classTree) {
            self.$refs.classTree.$refs.panel.activePath = [];
            self.$refs.classTree.$refs.panel.calculateCheckedNodePaths();
          }
        },
      };
    },
  },

  filters: {
    getInvoice(status) {
      switch (status) {
        case "0":
          return "开立";
          break;
        case "1":
          return "审核";
          break;
        case "2":
          return "退回";
          break;
        default:
          return "无";
      }
    },
  },

  components: {
    selectMaterial,
    selectCustomer,
    selectSupplier,
    selectOutsource,
    selectImportMaterial,
    selectLocation,
    purchaseCheckin,
    prsCheckin,
    omReject,
    PrintPage,
  },
  watch: {},
};
</script>

<style lang="scss">
.menu-drop-in {
  .el-dropdown-menu__item {
    width: 90px;
    text-align: center;
    position: relative;

    span {
      display: inline-block;
    }

    i {
      position: absolute;
      left: 15px;
      top: 7px;
    }
  }

  .active {
    i,
    span {
      color: #46a6ff;
    }
  }
}
.wm-checkin {
  .el-textarea__inner {
    font-size: 14px;
    color: #303133;
    padding: 5px 10px !important;
  }
  .period-select {
    .el-input__inner {
      padding-left: 30px;
    }
  }
  .period-date {
    position: absolute;
    left: 12px;
    top: 11px;
    color: #c0c4cc;
  }
  .code-red {
    input {
      color: #fc6a6a !important;
    }
  }
  .el-textarea.is-disabled .el-textarea__inner {
    color: #333;
  }
  .input-pp {
    .el-icon-date,
    .el-input__icon {
      line-height: 30px !important;
    }

    .el-input__inner {
      font-size: 13px;
    }
  }

  .code-yellow {
    input {
      color: #e6a23c !important;
    }
  }

  .purchas-information {
    .el-card__body {
      padding: 15px 20px 10px 20px;
    }
    .el-input__inner,
    .el-textarea__inner {
      width: 210px;
    }
  }

  .set-location {
    display: flex;
    align-items: center;

    .location-btn {
      flex-shrink: 1;
      width: 40px;
      margin-right: 5px;
      height: 20px;
    }
  }

  .el-card.is-always-shadow {
    overflow: inherit;
  }

  .blue-red {
    label:nth-of-type(2) {
      .is-checked .el-radio__inner {
        background: #fc6a6a;
        border-color: #fc6a6a;
      }

      .is-checked + .el-radio__label {
        color: #fc6a6a;
      }

      font-size: 20px;
    }
  }

  .unfold-way {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;

    p {
      margin: 0;
      margin-bottom: 8px;
    }
  }

  .con-spec {
    display: flex;
    text-align: center;
    justify-content: center;
    word-wrap: break-word;

    .spec-l {
      padding-right: 2px;

      input {
        text-align: right !important;
      }
    }

    .spec-r {
      input {
        text-indent: 0 !important;
        text-align: left !important;
      }
    }
  }

  .el-radio__input.is-disabled.is-checked .el-radio__inner {
    border-color: #1890ff;
    background: #1890ff;
  }

  .el-radio__input.is-disabled + span.el-radio__label {
    color: #333;
  }

  .info-list {
    .articles-numbers {
      margin-bottom: 5px;
      text-align: right;

      a {
        font-size: 14px;
        margin-left: 15px;
        color: #1890ff;

        &:hover {
          opacity: 0.7;
        }
      }
    }

    .wn-in-box {
      display: flex;
    }

    .list-box {
      .box-input {
        display: flex;
        margin-right: 30px;
        align-items: center;
        margin-bottom: 5px;
        position: relative;
        .input-select {
          margin-left: 5px;
        }

        p {
          flex-shrink: 0;
          width: 70px;
          font-size: 14px;
          margin: 0px;
        }

        .el-input {
          width: auto;
          flex: 1;
        }

        .el-textarea {
          width: 100%;
          flex: 1;
        }

        .drop-menu {
          position: absolute;
          width: 210px;
          box-shadow: 1px 1px 5px 1px #eee;
          max-height: 500px;
          overflow: auto;
          z-index: 9;
          background: #fff;
          left: 70px;
          top: 35px;
          color: #606266;

          p {
            padding: 10px;
            text-align: center;
            width: 100%;
            color: #606266;
          }

          .menu-close {
            position: sticky;
            top: 0;
            width: 210px;
            text-align: right;
            height: 30px;
            background: #fff;
            line-height: 30px;
            border-bottom: 1px solid #eee;

            .search-top {
              display: flex;
              justify-content: space-between;
              align-items: center;

              span {
                font-size: 14px;
                margin-left: 10px;
                color: #606266;
              }
            }

            a {
              padding-right: 10px;
              font-size: 14px;
            }
          }

          .ma-list {
            .list-t {
              text-align: left;
              cursor: pointer;
              border-bottom: 1px solid #eee;
              font-size: 14px;
              padding-top: 5px;
              padding-bottom: 5px;

              &:hover {
                background-color: #f5f7fa;
              }

              .po-content {
                display: flex;
                align-items: center;
              }

              span {
                display: inline-block;
                margin-left: 10px;
                margin-right: 10px;
              }
            }
          }
        }
      }
    }

    .el-input.is-disabled .el-input__inner {
      color: #333;
    }

    .blue-color .is-disabled .el-input__inner {
      color: #1890ff;
    }
  }

  .purchas-content {
    margin-top: 10px;

    .el-table--border {
      border-left: 1px solid #dfe6ec;
    }
    .el-textarea__inner {
      border: none;
    }
    .el-textarea.is-disabled .el-textarea__inner {
      background: none;
    }
    .el-table__row td:first-child,
    .has-gutter th:first-child {
      border-left: none;
    }

    .clearfix {
      p {
        margin: 0;
        margin-bottom: 8px;
      }
    }

    .el-card__header {
      padding-right: 20px;
    }

    .el-input__inner {
      height: 31px;
      line-height: 0;
      padding: 0 5px;
      color: #606266;
    }

    .el-input__icon {
      line-height: 0;
    }

    .el-table .cell {
      overflow: inherit;
    }

    .select-name {
      display: flex;
      align-items: center;

      .el-input {
        flex: 1;
      }

      span {
        line-height: 20px;
        margin-left: 5px;
        font-size: 14px;
        margin-right: 5px;
      }
    }

    .el-card__body {
      padding-bottom: 10px;
    }

    .table-data {
      .el-table__body-wrapper {
        overflow: auto;

        .cell {
          height: auto !important;
        }
      }

      .el-table .el-table__header-wrapper th,
      .el-table .el-table__fixed-header-wrapper th {
        height: 35px !important;
      }

      .cell {
        padding: 0;
      }

      .el-input--medium .el-input__inner {
        background: none;
        border-color: #fff;
        border-radius: 0;
        padding: 0;
        text-align: center;
      }

      .el-form-item.is-error .el-input__inner,
      .el-form-item.is-error .el-input__inner:focus,
      .el-form-item.is-error .el-textarea__inner,
      .el-form-item.is-error .el-textarea__inner:focus {
        border-color: #ff4949;
      }

      .el-table--enable-row-hover .el-table__body tr:hover > td {
        background: none;
      }

      .el-table--medium th,
      .el-table--medium td {
        padding: 0 !important;
        text-align: center;
      }

      .el-form-item--medium .el-form-item__content {
        line-height: 30px;
      }

      .add-icon {
        margin-top: 5px;
        text-align: center;
      }
    }

    .el-form-item__error {
      padding-top: 0;
      top: 90%;
    }
  }

  .save-btn {
    margin: 20px;

    button {
      width: 200px;
    }
  }

  .el-form-item {
    margin-bottom: 0;
  }

  .button-plan span {
    display: inline-block;

    button {
      margin-left: 10px;
    }
  }

  .invoice-box {
    background-color: #f5f7fa;
    border-color: #dfe4ed;
    width: 100%;
    padding: 0px 15px;
    height: 32px;
    line-height: 27px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    margin-bottom: 3px;
    margin-top: 3px;

    span {
      font-size: 14px;
    }
  }

  .text-right {
    input {
      text-align: right !important;
      padding-right: 10px !important;
    }

    span {
      display: inline-block;
      padding-right: 10px;
      width: 100%;
      text-align: right;
    }
  }

  .select-box {
    position: relative;

    .drop-menu1 {
      position: absolute;
      width: 395px;
      box-shadow: 1px 1px 5px 1px #eee;
      max-height: 300px;
      overflow: auto;
      z-index: 9;
      background: #fff;

      .menu-close {
        position: sticky;
        top: 0;
        width: 395px;
        text-align: right;
        height: 30px;
        background: #fff;
        line-height: 30px;

        .search-top {
          display: flex;
          justify-content: space-between;
          align-items: center;

          span {
            font-size: 14px;
            margin-left: 10px;
          }
        }

        a {
          padding-right: 10px;
        }
      }

      .ma-list {
        margin-bottom: 10px;

        .list-t {
          text-align: left;
          cursor: pointer;
          border-bottom: 1px solid #eee;
          font-size: 14px;

          &:hover {
            background-color: #f5f7fa;
          }

          span {
            display: inline-block;
            margin-left: 10px;
            margin-right: 10px;
          }
        }
      }
    }
  }

  .matrial-box .basicfile-box .cell {
    height: auto !important;
  }

  .el-card__header {
    padding-right: 20px;
  }
}
</style>
